package com.huang.computer.controller;

import com.huang.computer.entity.Student;
import com.huang.computer.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.configurationprocessor.json.JSONArray;
import org.springframework.boot.configurationprocessor.json.JSONException;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
public class AjaxController {
    @Autowired
    IStudentService iStudentService;
    @RequestMapping("/a1")
    public String StudentSelectId(@RequestBody String username) throws JSONException {
        //获取用户名
        Student student = iStudentService.StudentSelectId(username.substring(9));
        String msg = "";
        if (student!=null){
                msg = "OK";
            }else {
                msg = "学号不存在";
            }
        return msg;
    }
}
